home *** CD-ROM | disk | FTP | other *** search
/ Megadoom II / MEGADOOM II - iso.7z / MEGADOOM II.ISO / doom / help / lmp / lmp10 / lmp10.doc
Text File  |  1994-10-07  |  10KB  |  279 lines

  1.               ******************************************
  2.               *                                        *
  3.               *  The unofficial LMP format description *
  4.               *                                        *
  5.               ******************************************
  6.  
  7.             
  8.             Public Version 1.0, 30 August, 1994
  9.             (internal Revision 18)
  10.             Written by: Uwe Girlich 
  11.         (girlich@aix520.informatik.uni-leipzig.de)
  12.  
  13.  
  14. 1. Introduction
  15. ***************
  16.  
  17. A DOOM lmp file records all player actions. The monster movements, respawn  
  18. positions etc. are totally deterministic.
  19.  
  20. A lmp file consists of a header, a data area and a quit byte. 
  21.  
  22.  * The header contains the skill, episode, start map, number of players etc.
  23.  * The data area is divided in game tics. For each player there are four
  24.    movement bytes per game tic.
  25.  * Each lmp should end with a quit byte (80h).
  26.  
  27. The duration of a gametic is round 1/35s. With time measurements with
  28. 4dos:
  29.         timer ^ doom -playdemo name ^ timer
  30. of many differnet lmp's and linear curve fitting I found a slightly differnet
  31. frequency: 35.003Hz.
  32. So it is not wrong to speak of 35Hz but it is not totally correct.
  33.  
  34.  
  35. 2. HEADER
  36. *********
  37.  
  38. Many thanks to Steffen Winterfeldt (wfeldt@tph100.physik.uni-leipzig.de)
  39. for his reverse engineering work.
  40.  
  41. The easiest way to check the length of the header is to start DOOM with the
  42. record option. Then you have to press 'q' during the startup sequence. 
  43. In the moment, when the screen switchs from text mode to graphics mode,
  44. the game stops and you receive the shortest lmp file. It consists only of 
  45. the header and the quit game byte.
  46.  
  47. The lmp header format is a subject of change. 
  48. Until DOOM 1.2 was the format of the 7 byte header:
  49.  
  50. Byte  Type Contents
  51. 0000h Byte skill   (0-4)
  52. 0001h Byte episode (1-3)
  53. 0002h Byte map     (1-9)
  54. 0003h Byte 0/1     (green player)  \  
  55. 0004h Byte 0/1     (indigo player)  \ 0: this player doesnt play 
  56. 0005h Byte 0/1     (brown player)   / 1: this player plays
  57. 0006h Byte 0/1     (red player)    /
  58. The number of bytes (3-6) unequal to zero is the number of players.
  59.  
  60. From Version 1.4 on the header consists of 13 bytes:
  61.  
  62. Byte  Type Contents
  63. 0000h Byte version (104d=68h DOOM 1.4, 105d=69h DOOM 1.5)
  64. 0001h Byte skill   (0-4)
  65. 0002h Byte episode (1-3)
  66. 0003h Byte map     (1-9)
  67. 0004h Byte multiplayer rule (0: Cooperative, 1: DeathMatch, 2: AltDeath)
  68. 0005h Byte respawn    0: off, !=0: on \  a value != 0 is the number of
  69. 0006h Byte fast       0: off, !=0: on  > this command line parameter
  70. 0007h Byte nomonsters 0: off, !=0: on /  (with expanded @paramfile)
  71. 0008h Byte the lmp is recorded from this player's view (0-3)
  72. 0009h Byte 0/1     (green player)  \  
  73. 000Ah Byte 0/1     (indigo player)  \ 0: this player doesnt play 
  74. 000Bh Byte 0/1     (brown player)   / 1: this player plays
  75. 000Ch Byte 0/1     (red player)    /
  76. The number of bytes (9-C) unequal to zero is the number of players.
  77.  
  78. Now it is very easy to change a existing lmp from one format to the other.
  79. The movement algorithm didn't changed from DOOM 1.2 to DOOM 1.5 beta.
  80. This is only true if the map also didnt changed. So you cant recycle lmp's
  81. of e1m4. It is very interesting, that 1.5 lmp's, recorded even with the turbo
  82. option work with 1.2.
  83.  
  84.  
  85. 3. DATA
  86. *******
  87.  
  88. 3.1 Number of game tics
  89. =======================
  90.  
  91. This formula for the number of game tics (NGT) follows from the first 
  92. section:
  93.         
  94.         filelength-headerlength-1
  95.     NGT =   -------------------------
  96.           4 * number of players
  97.  
  98. The NGT stored in a lmp can also be found out with the -timedemo option. 
  99. At the replay end, doom shows the number of game tics and time tics.
  100. This game tic number corresponds with NGT only in newer versions of 
  101. DOOM (>=1.4). Older versions of DOOM report the wrong number (NGT+1).
  102.  
  103. With timedemo DOOM plays __all__ scenes in the lmp file back but without 
  104. any synchronizing. So you can calculate also the frames per second with:
  105.         
  106.                NGT
  107.           fps = --------- * 35
  108.             time tics
  109.  
  110. This has nothing to do with your frame rate during the game. 
  111. This frame rate can be computed with the formula (from the FAQ v5.7 *9-3-1*,
  112. thanks to Hank Leukart (ap641@cleveland.freenet.edu))
  113.  
  114.                70
  115.           fps = --------
  116.             dots + 1
  117.  
  118. The dots are displayed with the -devparm option in the lower left edge of
  119. the screen. There are only 35 screens per second (each game tic), so one
  120. dot is always displayed. With every additional dot, DOOM shows how many
  121. vertical sync impulses (1/70s) were necessary to compute a whole screen. 
  122. The game is not slower but you don't see each screen: the game becomes jerky.
  123.  
  124.  
  125. 3.2 Multiplayer lmp
  126. ===================
  127.  
  128. In a 2, 3 or 4 player game the game tics are alternated stored, ie for a 
  129. 2 player game:
  130. game tic 1 of player 0
  131. game tic 1 of player 1
  132. game tic 2 of player 0
  133. game tic 2 of player 1
  134. game tic 3 of player 0
  135. game tic 3 of player 1
  136.        .
  137.        .
  138.        .
  139.  
  140.  
  141. 3.3 The -turbo parameter
  142. ========================
  143.  
  144. This parameter speeds up all moves (forward, backward, strafe sideways) but
  145. not the turn. Due to the value sets described in section 3.4 all move bytes
  146. can be multiplied by 2.55 (or 255%) until they dont fit in a short int. 
  147. This is exactly what happens. 
  148. All normal move bytes are multiplied by the turbo value in percent.
  149. So you can play with -turbo 200 a normal game but your speed is the same as
  150. the shift key is always pressed. If you now press the shift key you are
  151. running like hell.
  152.  
  153. The turbo parameter isn't stored in the lmp but DOOM shows in the message 
  154. line, if a player plays with turbo (ie "green is turbo"). DOOM conclude this
  155. from very large move bytes.
  156.  
  157.  
  158. 3.4 Data description
  159. ====================
  160.  
  161. One game tic (for one player) corresponds to 4 bytes:
  162.   
  163.   |    0    |    1    |    2    |    3    |
  164.   |   go    | strafe  |  turn   |   use   |
  165.  
  166.  
  167. 3.4.1. Byte 00h: Go Forward and Backward
  168. ----------------------------------------
  169.  
  170. The go byte contains a signed number (-127 (81h).. 127 (7Fh)), where 
  171. positive numbers describe a forward and negative numbers a backward move. 
  172. In older DOOM versions (and now with -turbo 100) the values go from
  173. -50 (CEh)... 50 (32h). 
  174. With a mouse you can achive all these codes.
  175. The codes for keyboard/joystick actions are:
  176. -25 (E7h) / +25 (19h) go backward/forward
  177. -50 (CEh) / +50 (32h) go backward/forward with speed on
  178.  
  179.  
  180. 3.4.2 Byte 01h: Strafe Sideways
  181. -------------------------------
  182.  
  183. The strafe byte contains a signed number (-127 (81h).. 127 (7Fh)), where 
  184. positive numbers describe a right and negative numbers a left move. 
  185. In older DOOM versions (and now with -turbo 100) the values go from
  186. -50 (CEh)... 50 (32h). 
  187. With a mouse you can achive all these codes.
  188. The codes for keyboard/joystick actions are:
  189. -24 (E8h) / +24 (18h) strafe left/right
  190. -50 (CEh) / +50 (32h) strafe left/right with speed on
  191.  
  192.  
  193. 3.4.3 Byte 02h: Turn
  194. --------------------
  195.  
  196. The turn byte contains a signed number (-127 (81h).. 127 (7Fh)), where 
  197. positive numbers describe a left and negative numbers a right turn. 
  198. The values go from -127 (81h)... 127 (7Fh). In my lmp's the maximal values 
  199. are Turn Left 76 (4Ch) and Turn Right 78 (B2h).
  200. With a mouse you can achive all these codes.
  201.  
  202. The codes for keyboard/joystick actions (in DOOM version <1.4) are:
  203.  -2 (FEh) /  +1 (01h) start turn right/left
  204.  -3 (EDh) /  +2 (02h) turn right/left
  205.  -5 (FBh) /  +5 (05h) turn right/left with speed on
  206. Very strange is the fact, that the keyboard controlled right turn is faster 
  207. than the keyboard controlled left turn. This must be a bug.
  208.  
  209. The codes for keyboard/joystick actions (in DOOM version >=1.5) are:
  210.  -1 (FEh) /  +1 (01h) start turn right/left
  211.  -2 (EDh) /  +3 (02h) turn right/left
  212.  -5 (FBh) /  +5 (05h) turn right/left with speed on
  213. Now some people at id corrected the right turn but now is the left turn
  214. a bit faster.
  215.  
  216.  
  217. 3.4.4 Byte 03h: Use
  218. -------------------
  219.    
  220. In the use byte are coded the fire weapon, the press button/open door and the
  221. change weapon actions:
  222.  
  223.    --------------------------------------------
  224.    | 7     | 6  | 5  | 4  | 3  | 2  | 1  | 0  |
  225.    | SA=0  | 0  |    Weapon    | WB | UB | FB |
  226.    --------------------------------------------
  227.  
  228. The Fire Bit (FB) is 1 during a shot. The Use Bit (UB) indicates the use 
  229. of anything (press a button, open a door etc.). The Weapon Bit (WB) is 1 if 
  230. the player changes manually his weapon. The weapon number is stored in the 
  231. following bits.
  232.  
  233. The weapon numbers are beginning with 0; not with 1 as is the status bar:
  234.        Code := 4 + 8* (Weapon-1)
  235.  
  236. The codes are:
  237.    4 (04h) Activate Weapon 1 (Fist)
  238.   12 (0Ch) Activate Weapon 2 (Pistol)
  239.   20 (14h) Activate Weapon 3 (Shotgun)
  240.   28 (1Ch) Activate Weapon 4 (Chaingun)
  241.   36 (24h) Activate Weapon 5 (Rocket Launcher)
  242.   44 (2Ch) Activate Weapon 6 (Plasma Rifle)
  243.   52 (34h) Activate Weapon 7 (BFG 9000)
  244.  
  245. The bits can be composed. So you can with a use byte of 03h fire and use
  246. at the same time.
  247.  
  248. If the Special Actions (SA) bit is 1, the meaning of the other bits
  249. changes totally:
  250.  
  251. In the bits 0 and 1 is now coded the Special Action itself.
  252. -----------------
  253. |1|x|x|x|x|x|0|1|    stands for pause/unpause
  254. -----------------
  255.  
  256. and
  257.  
  258. -----------------
  259. |1|x|x| SLN |1|0|    stands for save game in slot SLN (0<=SLN<=7).
  260. ----------------- 
  261.  
  262. The x-bits aren't important at all. DOOM itselft let they 0 but does not
  263. analyze them afterwards. 
  264.  
  265. DOOM saves the game even during the replay of a lmp.
  266.   
  267. Since I don't have access to a DOOM network I can only guess, that also
  268. the messages (chat mode) are coded in any way in a lmp.
  269.  
  270. 3.4.5. Special entries
  271. ----------------------
  272.  
  273. If there are no actions at all, all 4 bytes contain 00h. This is a wait tic.
  274. The end of the lmp is coded in the go byte of an uncomplete game tic.
  275. Because there is no go value of -128 (80h), DOOM can't make a mistake.
  276.  
  277. Uwe Girlich                    30.8.1994
  278. girlich@aix520.informatik.uni-leipzig.de
  279.